package com.hspedu.enum_;

/**
 * @author DL5O
 * @version 1.0
 */
public class Enumeration02 {
    public static void main(String[] args) {
        System.out.println(Season_.SPRING);
        System.out.println(Season_.SUMMER);
        System.out.println(Season_.AUTUMN);
        System.out.println(Season_.WINTER);

    }
}


/*
    演示自定义枚举实现
 */
class Season_{
    private String name;
    private String desc;//描述

    //1.将构造器私有化，目的防止直接new
    //2.去掉set相关的方法，目的防止属性被修改
    //3.在Season_内部，创建固定的对象
    //拥有固定的四个对象
    //优化一下加入final关键字，让他为常量
    public final static Season_ SPRING = new Season_("春天", "温暖");
    public final static Season_ WINTER = new Season_("冬天", "寒冷");
    public final static Season_ AUTUMN = new Season_("秋天", "凉爽");
    public final static Season_ SUMMER = new Season_("夏天", "炎热");

    private Season_(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return "Season_{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}
